package com.bw.common.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.blankj.utilcode.util.ToastUtils
import com.gyf.immersionbar.ImmersionBar

/**
 * 基础Activity
 */
abstract class BaseActivity<VDB:ViewDataBinding>:AppCompatActivity() {

    lateinit var mDataBind:VDB

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mDataBind=DataBindingUtil.setContentView(this,getLayoutId())
        //沉浸式状态栏
        ImmersionBar.with(this).init()
        initViews()
    }
    fun showToastMsg(msg:String){
        if (!msg.isNullOrEmpty()){
            ToastUtils.showLong(msg)
        }
    }

    abstract fun initViews()

    abstract fun getLayoutId(): Int
}